//
//  CellOfAudio.m
//  To Feel
//
//  Created by 于成哲 on 16/7/23.
//  Copyright © 2016年 caoyu. All rights reserved.
//

#import "CellOfAudio.h"
#import "ModelOfAudioClassify.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
@interface CellOfAudio ()
@property (nonatomic ,retain) UIImageView *imagePic;
@end
@implementation CellOfAudio
- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self createSubViews];
    }
    
    return self;
}

- (void)createSubViews {
    
    self.imagePic = [[UIImageView alloc] init];
    
    [self.contentView addSubview:self.imagePic];
    
    self.imagePic.backgroundColor = [UIColor redColor];
}

- (void)setModel:(ModelOfAudioClassify *)model {
    
    if (_model != model) {
        
        _model = model;
    }
    
    [self.imagePic sd_setImageWithURL:[NSURL URLWithString:model.coverMiddle]];
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    [self.imagePic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).with.offset(0);
        make.left.equalTo(self.contentView).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(0);
        make.bottom.equalTo(self.contentView).with.offset(0);
    }];
}
@end
